/**
 * 
 */
package org.mspring.mlog.web.module.stat.factory;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.mspring.mlog.core.ServiceFactory;
import org.mspring.mlog.service.NewsService;
import org.mspring.platform.utils.RequestUtils;

/**
 * @author Gao Youbo
 * @since 2012-11-16
 * @Description
 * @TODO 博客点击量
 */
public class NewsClickStatCmd extends AbstractStatCmd {
    private static final Logger log = Logger.getLogger(NewsClickStatCmd.class);

    @Override
    public boolean execute(HttpServletRequest request) {
        // TODO Auto-generated method stub
        Long id = RequestUtils.getRequestParameterAsLong(request, "id");
        if (id == null) {
            return false;
        }
        try {
            ServiceFactory.getBean(NewsService.class).updateViews(id);
            return true;
        } catch (Exception e) {
            // TODO: handle exception
            log.error("update blog click error.", e);
            return false;
        }
    }

}
